/**
 * 获取图片尺寸
 * @param url
 * @returns
 */
export function getImageSize(url: string): Promise<{ width: number; height: number }> {
  return new Promise((resolve, reject) => {
    const img = new Image()
    img.src = url
    img.onload = () => {
      resolve({
        width: img.width,
        height: img.height
      })
    }
    img.onerror = (err) => {
      reject(err)
    }
  })
}
